package com.ruoyi.fly.enums;


import lombok.Getter;
import lombok.Setter;

public enum StoreType {

    REPAIR(1, "汽修店"),
    MAINTENANCE(2, "保养店"),
    BEAUTY(3, "美容店"),
    WRAP(4, "贴膜店"),
    CARWASH(5, "洗车店"),
    TIRECHANGING(6, "轮胎更换店"),
    RESCUE(7, "救援店"),
    GASSTATION(8, "加油站");
    @Setter @Getter
    private Integer code;
    @Setter @Getter
    private String desc;


    StoreType(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

//    public static StoreStatus findByCode(Integer code) {
//        Optional<StoreStatus> first = Arrays.stream(StoreStatus.values()).filter(item -> item.getCode().equals(code)).findFirst();
//        first.orElseGet(()->{
//
//            return   StoreStatus.REPAIR;
//        });
//        return first.orElse(null);
//    }

    public static String getValue(Integer code) {
        if (code == null) {
            return "";
        }
        for (StoreType value : StoreType.values()) {
            if (value.code.equals(code)){
                return value.desc;
            }
        }
        return "";
    }



}
